﻿using DXApplicationTangche.UC.抖音出入库.Service;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DXApplicationTangche.UC.抖音出入库
{
    public partial class Form抖音保存成衣参考码 : DevExpress.XtraEditors.XtraForm
    {
        private String skuId { get; set; }
        public Form抖音保存成衣参考码(DouyinSkuDao douyinSkuDao)
        {
            InitializeComponent();
            this.showText(douyinSkuDao);
        }

        private void showText(DouyinSkuDao douyinSkuDao)
        {
            this.skuId = douyinSkuDao.skuId;
            this.textBox规格ID.Text = douyinSkuDao.skuId;
            //
            this.textBox商品ID.Text = douyinSkuDao.productId;
            this.textBox商品描述.Text = douyinSkuDao.productName;
            this.hyperLinkEdit商品链接.Text = douyinSkuDao.url;
            this.textBox款号.Text = douyinSkuDao.styleCode;
            this.textBox面料号.Text = douyinSkuDao.materialCode;
            this.textBox规格.Text = douyinSkuDao.spec;
            //
            this.textBox尺码.Text = douyinSkuDao.styleSizeCd;
            //
            this.textBox成衣码.Text = douyinSkuDao.barcode;
            this.textBox时间.Text = douyinSkuDao.createDate.ToString();
        }

        /// <summary>
        /// 更新成衣码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void simpleButton确认_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(this.skuId))
            {
                return;
            }
            if (String.IsNullOrEmpty(this.textBox成衣码.Text))
            {
                MessageBox.Show("请输入成衣码");
                return;
            }
            DouyinSkuDao douyinSkuDao = 抖音Service.saveSkuCode(this.skuId, this.textBox成衣码.Text.Trim());
            this.showText(douyinSkuDao);
        }

        /// <summary>
        /// 更新尺码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void simpleButton更新尺码_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(this.skuId))
            {
                return;
            }
            if (String.IsNullOrEmpty(this.textBox尺码.Text))
            {
                MessageBox.Show("请输入尺码");
                return;
            }
            DouyinSkuDao douyinSkuDao = 抖音Service.updaetSkuStyleSizeCd(this.skuId, this.textBox尺码.Text.Trim());
            this.showText(douyinSkuDao);
        }
    }
}
